package net.xdclass.strategy;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

public class ShardingTableConfig {

    private static final List<String> tbPrefixList = new ArrayList<>();

    private static Random random = new Random();

    static {
        tbPrefixList.add("0");
        tbPrefixList.add("a");
    }

    /**
     * 获取随机前缀
     * @return
     * @param code
     */
    public static String getRandomTableSuffix(String code) {
        int hashCode = code.hashCode();
        int index = Math.abs(hashCode) % tbPrefixList.size();
        return tbPrefixList.get(index);
    }


}
